package com.dowson.service;

import com.dowson.dao.BookDao;
import com.dowson.dao.PersonDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author Zoe
 * @Date: 2020/11/24
 * @Description
 */
@Service
public class PersonService {
    /**
     * 自动装配：
     * 1：Autowired
     * 默认按照类型从容器中找对应的组件annotationConfigApplicationContext.getBean(Person.class);
     * 如果找到多个相同类型的组件，再将属性的名称作为组件的id去容器中查找annotationConfigApplicationContext.getBean("Person");
     * <p>
     * 2：@Qualifier
     * 指定组件的属性名去装配
     */
    @Autowired
    PersonDao personDao;

    @Resource
    BookDao bookDao;

    public void getPersonDao() {
        System.out.println(personDao.toString());
    }
    public void getBookDao() {
        System.out.println(bookDao.toString());
    }
}
